package com.qdaily.ui.ui.views;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.TextView;

import com.qdaily.ui.R;

/**
 * Created by song on 15/5/25.
 */
public class CommentOrPraiseTextView extends TextView{
    public CommentOrPraiseTextView(Context context) {
        super(context);
    }

    public CommentOrPraiseTextView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CommentOrPraiseTextView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    public void setNum(int num)
    {
        if (num == 0)
        {
            this.setVisibility(GONE);
        }
        else
        {
            this.setText(num + "");
            this.setVisibility(VISIBLE);
        }
    }

    public void setCommentTotalNum(int num)
    {
        if (num == 0)
        {
            this.setVisibility(GONE);
        }
        else
        {
            this.setText(getResources().getString(R.string.comments_number, num));
            this.setVisibility(VISIBLE);
        }
    }

}
